using System.Collections.Generic;
using Entitas;

public sealed class StartEnemyWaveSystem : ReactiveSystem {

    public StartEnemyWaveSystem(Contexts contexts) : base(contexts.core) {

    }

    protected override Collector GetTrigger(Context context) {
        return context.CreateCollector(Matcher.AllOf(CoreMatcher.View, CoreMatcher.Enemy));
    }

    protected override bool Filter(Entity entity) {
        return true;
    }

    protected override void Execute(List<Entity> entities) {
        foreach(var e in entities) {
            var enemyViewController = (IEnemyController)e.view.controller;
            enemyViewController.InitWithWave(GameRandom.core.RandomInt(1, 3));
        }
    }
}
